﻿@if (IsCurrentUser)
{
    <MudPaper Class="pa-2" Elevation="0" Outlined Style="position:relative;">
        <MudStack Spacing="0">
            <MudText Class="text-single-line" Typo="Typo.subtitle1" Color="Color.Primary">@DisplayName</MudText>
            <MudText Class="text-single-line" Typo="Typo.subtitle2" Color="Color.Default">@Date</MudText>
        </MudStack>
        <MudText Class="mt-2 pr-12" Typo="Typo.body1" Style="white-space: initial;overflow-wrap: break-word;">@Content</MudText>
        <MudStack Row Style="position:absolute;bottom:0;right:0;" Class="pa-2" Spacing="0">
            @if (SentOnDate is not null && SeenOnDate is not null)
            {
                <MudIcon Icon="@Icons.Material.Filled.Check" Color="Color.Default" />
                <MudIcon Icon="@Icons.Material.Filled.Check" Color="Color.Default" />
            }
            else if (SentOnDate is not null)
            {
                <MudIcon Icon="@Icons.Material.Filled.Check" Color="Color.Default" />
            }
        </MudStack>
    </MudPaper>
}
else
{
    <MudPaper Class="pa-2" Elevation="0" Outlined>
        <MudStack Spacing="0">
            <MudText Class="text-single-line" Typo="Typo.subtitle1">@DisplayName</MudText>
            <MudText Class="text-single-line" Typo="Typo.subtitle2" Color="Color.Default">@Date</MudText>
        </MudStack>
        <MudText Class="mt-2" Typo="Typo.body1" Style="white-space: initial;overflow-wrap: break-word;">@Content</MudText>
    </MudPaper>
}

@code {
    [Parameter]
    public string DisplayName { get; set; }
    [Parameter]
    public string Content { get; set; }
    [Parameter]
    public string Date { get; set; }
    [Parameter]
    public bool IsCurrentUser { get; set; }
    [Parameter]
    public DateTimeOffset? SentOnDate { get; set; }
    [Parameter]
    public DateTimeOffset? SeenOnDate { get; set; }
}
